<template>
  <div class="registration-container">
    <div class="page-header">
      <h2 class="main-title">活动报名详情</h2>
    </div>
    
    <section class="content-section activity-section">
      <div class="activity-card">
        <div class="activity-hero">
          <img
            :src="pageData.cover"
            alt="活动封面"
            class="activity-banner"
          />
          <div class="activity-title-container">
            <h2 class="activity-title">{{ pageData.title }}</h2>
            <el-tag
              :type="statusMap[pageData.status]?.type || 'info'"
              class="status-tag"
              effect="dark"
              size="large"
            >
              {{ statusMap[pageData.status]?.text || "未知状态" }}
            </el-tag>
          </div>
        </div>
        
        <div class="activity-stats">
          <div class="stat-box">
            <div class="stat-icon">
              <el-icon><User /></el-icon>
            </div>
            <div class="stat-content">
              <span class="stat-label">报名上限</span>
              <span class="stat-value">{{ pageData.participantsCount }}</span>
            </div>
          </div>
          <div class="stat-box">
            <div class="stat-icon highlight">
              <el-icon><DataLine /></el-icon>
            </div>
            <div class="stat-content">
              <span class="stat-label">已报名</span>
              <span class="stat-value highlight">{{ pageData.registerCount }}</span>
            </div>
          </div>
          <div class="stat-box">
            <div class="stat-icon date-icon">
              <el-icon><Calendar /></el-icon>
            </div>
            <div class="stat-content">
              <span class="stat-label">开始时间</span>
              <span class="stat-value time">{{ pageData.startTime }}</span>
            </div>
          </div>
          <div class="stat-box">
            <div class="stat-icon time-icon">
              <el-icon><Timer /></el-icon>
            </div>
            <div class="stat-content">
              <span class="stat-label">结束时间</span>
              <span class="stat-value time">{{ pageData.endTime }}</span>
            </div>
          </div>
        </div>
      </div>
    </section>

    <div class="info-container">
      <section class="content-section info-section organizer-section">
        <div class="section-header">
          <h3><el-icon class="section-icon"><UserFilled /></el-icon>主办方信息</h3>
        </div>
        <div class="info-panel">
          <div class="info-item">
            <div class="info-icon">
              <el-icon><Avatar /></el-icon>
            </div>
            <div class="info-content">
              <span class="info-label">主办人</span>
              <span class="info-value">{{ pageData.holdName }}</span>
            </div>
          </div>
          <div class="info-item">
            <div class="info-icon">
              <el-icon><Phone /></el-icon>
            </div>
            <div class="info-content">
              <span class="info-label">联系电话</span>
              <span class="info-value">{{ pageData.holdPhone }}</span>
            </div>
          </div>
        </div>
      </section>

      <section class="content-section info-section details-section">
        <div class="section-header">
          <h3><el-icon class="section-icon"><InfoFilled /></el-icon>活动详情</h3>
        </div>
        <div class="info-panel">
          <div class="info-item">
            <div class="info-icon">
              <el-icon><Collection /></el-icon>
            </div>
            <div class="info-content">
              <span class="info-label">活动分类</span>
              <span class="info-value">{{ pageData.categoryName }}</span>
            </div>
          </div>
          <div class="info-item">
            <div class="info-icon">
              <el-icon><Location /></el-icon>
            </div>
            <div class="info-content">
              <span class="info-label">举办地点</span>
              <span class="info-value">{{ pageData.detailAddress }}</span>
            </div>
          </div>
        </div>
      </section>
    </div>

    <section class="content-section remark-section">
      <div class="section-header">
        <h3><el-icon class="section-icon"><Document /></el-icon>活动备注</h3>
      </div>
      <div class="remark-panel">
        <el-input
          type="textarea"
          :rows="5"
          v-model="pageData.remark"
          placeholder="请输入活动备注信息..."
          class="remark-input"
          resize="none"
        ></el-input>
      </div>
    </section>
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import { 
  User, 
  UserFilled, 
  DataLine, 
  Calendar, 
  Timer, 
  Avatar, 
  Phone, 
  InfoFilled, 
  Collection, 
  Location, 
  Document, 
  Check, 
  Share 
} from '@element-plus/icons-vue';

const props = defineProps({
  pageData: {
    type: Object,
    required: true,
  },
});

// 活动状态映射
const statusMap = {
  0: { text: "未发布", type: "info" },
  1: { text: "已发布", type: "success" },
  2: { text: "签到中", type: "warning" },
};
</script>

<style scoped lang="less">
.registration-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
  background-color: #f4f7fc;
  min-height: 100vh;
  color: #334155;
  font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.page-header {
  margin-bottom: 32px;
  
  .main-title {
    color: #0f172a;
    font-weight: 700;
    font-size: 32px;
    margin: 0;
    padding-bottom: 18px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    letter-spacing: 0.5px;
    
    &:after {
      content: "";
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 120px;
      height: 2px;
      background: linear-gradient(to right, #2563eb, #60a5fa);
    }
  }
}

.content-section {
  margin-bottom: 32px;
  border-radius: 16px;
  background-color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 6px 12px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.03);
  }
  
  &.activity-section {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08), 0 8px 14px rgba(0, 0, 0, 0.03);
  }
}

.section-header {
  padding: 22px 26px;
  border-bottom: 1px solid #e6eaf0;
  background: linear-gradient(to right, #f4f7fc, #ffffff);

  h3 {
    color: #0f172a;
    font-weight: 600;
    font-size: 18px;
    margin: 0;
    display: flex;
    align-items: center;
    
    .section-icon {
      margin-right: 12px;
      color: #2563eb;
      font-size: 20px;
    }
  }
}

.info-container {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  
  @media (max-width: 768px) {
    flex-direction: column;
  }
  
  .info-section {
    flex: 1;
    margin-bottom: 0;
    
    &.organizer-section:hover {
      box-shadow: 0 16px 36px rgba(37, 99, 235, 0.06), 0 8px 16px rgba(37, 99, 235, 0.03);
    }
    
    &.details-section:hover {
      box-shadow: 0 16px 36px rgba(16, 185, 129, 0.06), 0 8px 16px rgba(16, 185, 129, 0.03);
    }
  }
}

.activity-card {
  background-color: #ffffff;
  
  .activity-hero {
    position: relative;
    
    .activity-banner {
      width: 100%;
      height: 300px;
      object-fit: cover;
      filter: brightness(0.92);
      transition: filter 0.4s ease;
      
      &:hover {
        filter: brightness(1);
      }
    }
    
    .activity-title-container {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 36px 32px;
      background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
      display: flex;
      justify-content: space-between;
      align-items: center;
      
      .activity-title {
        color: #ffffff;
        font-size: 30px;
        font-weight: 700;
        margin: 0;
        text-shadow: 0 2px 6px rgba(0,0,0,0.5);
        flex: 1;
        letter-spacing: 0.5px;
      }
      
      .status-tag {
        font-weight: 500;
        padding: 10px 20px;
        border-radius: 8px;
        font-size: 14px;
        letter-spacing: 1px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
      }
    }
  }
  
  .activity-stats {
    display: flex;
    padding: 10px;
    flex-wrap: wrap;
    background: linear-gradient(to bottom, #fafbff, #ffffff);
    
    .stat-box {
      flex: 1;
      min-width: 150px;
      display: flex;
      align-items: center;
      padding: 24px;
      position: relative;
      
      &:not(:last-child):after {
        content: "";
        position: absolute;
        right: 0;
        top: 20%;
        height: 60%;
        width: 1px;
        background-color: #e2e8f0;
      }
      
      .stat-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
        background-color: #eef2ff;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 20px;
        color: #2563eb;
        font-size: 24px;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
        
        &:hover {
          transform: scale(1.05) rotate(5deg);
        }
        
        &.highlight {
          background-color: #ecfdf5;
          color: #10b981;
          box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
          
          &:hover {
            background-color: #d1fae5;
          }
        }
        
        &.date-icon {
          background-color: #eff6ff;
          color: #3b82f6;
          box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
          
          &:hover {
            background-color: #dbeafe;
          }
        }
        
        &.time-icon {
          background-color: #fef3c7;
          color: #d97706;
          box-shadow: 0 4px 12px rgba(217, 119, 6, 0.1);
          
          &:hover {
            background-color: #fde68a;
          }
        }
      }
      
      .stat-content {
        display: flex;
        flex-direction: column;
        
        .stat-label {
          font-size: 14px;
          color: #64748b;
          margin-bottom: 8px;
          letter-spacing: 0.5px;
        }
        
        .stat-value {
          font-size: 24px;
          font-weight: 600;
          color: #0f172a;
          
          &.highlight {
            color: #10b981;
          }
          
          &.time {
            font-size: 16px;
            letter-spacing: 0.5px;
          }
        }
      }
    }
  }
}

.info-panel {
  padding: 24px;
  
  .info-item {
    display: flex;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px dashed #e2e8f0;
    transition: all 0.2s ease;
    
    &:last-child {
      border-bottom: none;
    }
    
    &:hover {
      padding-left: 6px;
      
      .info-icon {
        transform: scale(1.05);
        background-color: #eef2ff;
        color: #2563eb;
      }
    }
    
    .info-icon {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      background-color: #f1f5f9;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 20px;
      color: #64748b;
      font-size: 22px;
      transition: all 0.3s ease;
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    }
    
    .info-content {
      flex: 1;
      
      .info-label {
        display: block;
        font-size: 14px;
        color: #64748b;
        margin-bottom: 8px;
        letter-spacing: 0.5px;
      }
      
      .info-value {
        font-size: 18px;
        color: #0f172a;
        font-weight: 500;
        letter-spacing: 0.2px;
      }
    }
  }
}

.remark-section {
  position: relative;
  
  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #2563eb, #60a5fa);
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
  }
}

.remark-panel {
  padding: 32px;
  
  .remark-input {
    width: 100%;
    margin-bottom: 16px;
    
    :deep(.el-textarea__inner) {
      border: 1px solid #cbd5e1;
      border-radius: 12px;
      padding: 22px;
      font-family: inherit;
      color: #0f172a;
      font-size: 16px;
      transition: all 0.3s ease;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
      
      &:focus {
        border-color: #2563eb;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
      }
      
      &::placeholder {
        color: #94a3b8;
        font-style: italic;
      }
    }
  }
}



@media (max-width: 768px) {
  .registration-container {
    padding: 20px;
  }
  
  .activity-stats {
    .stat-box {
      &:after {
        display: none;
      }
      
      padding: 16px;
      
      .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
        margin-right: 16px;
      }
      
      .stat-content .stat-value {
        font-size: 20px;
      }
    }
  }
  
  .activity-title-container .activity-title {
    font-size: 24px;
  }
  
  .page-header .main-title {
    font-size: 28px;
  }
  
  .cta-buttons .register-button, .cta-buttons .share-button {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .activity-stats {
    flex-direction: column;
    
    .stat-box {
      border-bottom: 1px solid #e2e8f0;
      
      &:last-child {
        border-bottom: none;
      }
    }
  }
}
</style>